    #include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <vector>

using namespace std;
using LL = long long;
const int mod = 100003;

int qmi(int q, LL k){
    int res = 1;
    while(k){
        if(k & 1){
            res = (LL) res * q % mod;
        }

        q = (LL)q * q % mod;
        k >>= 1;
    }
    return res;
}



int main(){

    LL m, n;
    scanf("%lld%lld", &m, &n);
    
    int k1 = qmi(m, n);
    int k2 = (LL) m * qmi(m - 1, n - 1) % mod;
    int res = (k1 - k2 + mod) % mod;

    printf("%d", res);

    return 0;
}